package yeqiang.vo;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * @author yeqiang
 * @since 2021/6/1 上午11:34
 */
@Data
@Accessors(chain = true)
public class R<T> implements Serializable {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 1L;

    public static int ERROR_CODE_SUCC = 0;
    public static int ERROR_CODE_FAIL = 1;

    /**
     * 业务错误码
     */
    private long code;
    /**
     * 结果集
     */
    private T data;
    /**
     * 描述
     */
    private String msg;

    public static R failed(String msg) {
        R r = new R();
        r.setCode(ERROR_CODE_FAIL);
        r.setMsg(msg);
        return r;
    }
}
